{{ $param := (.Get 0) }}

{{ $eventsData := index .Page.Site.Data .Page.Sites.First.Language.Lang }}

{{ $lastYear := sub (int (now.Format "2006")) 1 }}

<!-- Load events and number of times -->
{{ $countriesCodes := slice }}

{{ $eventsCounter := 0 }}
{{ with $eventsData }}
  {{ range (sort .events "year" "desc") }}
    {{ if eq (int .year) $lastYear }}
      {{ range .events }}
        {{ $eventsCounter = add $eventsCounter 1 }}
        {{ if .countryCode }}
          {{ $countriesCodes = $countriesCodes | append .countryCode }}
        {{ end }}
      {{ end }}
    {{ end }}
  {{ end }}
{{ end }}

{{ $countriesCodes = $countriesCodes | uniq }}

{{ if eq $param "countries" }}
  {{ len $countriesCodes }}
{{ end }}

{{ if eq $param "events" }}
  {{ $eventsCounter }}
{{ end }}
